/*
package com.jushan.liblbs.manager;

import android.content.Context;

import com.baidu.location.BDLocation;
import com.baidu.location.BDLocationListener;
import com.baidu.location.LocationClient;
import com.baidu.location.LocationClientOption;

import test.wx.share.shaun_xu.com.liblbs.interfaces.LocationActionInterface;
import test.wx.share.shaun_xu.com.liblbs.interfaces.LocationCallbackInterface;
import test.wx.share.shaun_xu.com.liblbs.model.LocationInfo;


*/
/**
 * @author Shaun_Xu
 * @description 位置的管理类，单例模式，用来配置，管理，监听位置信息
 * @date 17/3/10
 *//*



public class BDLocationActionManager implements LocationActionInterface {

    private LocationCallbackInterface mListener;

    private LocationClient mLocationClient;

    private BDLocationListener mBDLocationListener;


    private BDLocationActionManager() {
    }

    */
/*必须先init，再调用start*//*

    public void init(Context context) {
        if (mLocationClient == null) {
            mLocationClient = new LocationClient(context);
        }
        if (mBDLocationListener == null) {
            mBDLocationListener = new BDLocationListener() {
                @Override
                public void onReceiveLocation(BDLocation bdLocation) {              
                    if (mListener != null)
                        if (null != bdLocation && bdLocation.getAddress() != null && bdLocation.getLocType() != BDLocation.TypeServerError) {
                            mListener.onRecievePositon(changeInnerLocationInfo(bdLocation));
                        } else {
                            mListener.onRecievePositon(null);
                        }
                }

                @Override
                public void onConnectHotSpotMessage(String s, int i) {

                }
            };
        }
        mLocationClient.registerLocationListener(mBDLocationListener);
        initOption();
    }

    */
/*默认定位一次；bd09ll坐标系,默认不使用GPS*//*

    private void initOption() {
        LocationClientOption option = new LocationClientOption();
        option.setIsNeedAddress(true);
        option.setOpenGps(true);
        option.setIsNeedLocationDescribe(true);
        mLocationClient.setLocOption(option);
    }


    @Override
    public void start(Context context) {
        if(mLocationClient.isStarted())
            mLocationClient.requestLocation();
        else
            mLocationClient.start();

    }


    @Override
    public void stop() {
        if (mLocationClient != null)
            mLocationClient.stop();
    }

    @Override
    public void requestPosition() {
        if (mLocationClient != null)
            mLocationClient.requestLocation();
    }

    @Override
    public void setListener(LocationCallbackInterface listener) {
        this.mListener = listener;
    }

    private static class BDLocationManagerHolder {
        public final static BDLocationActionManager instance = new BDLocationActionManager();
    }

    public static BDLocationActionManager getInstance() {
        return BDLocationManagerHolder.instance;
    }


    private LocationInfo changeInnerLocationInfo(BDLocation bdLocation) {
        LocationInfo info = new LocationInfo();
        info.setmLatitude(bdLocation.getLatitude());
        info.setmLongitude(bdLocation.getLongitude());
        info.setmDesc(bdLocation.getLocationDescribe());
        if (bdLocation.getAddress() != null) {
            // if (bdLocation.getAddress().country != null)
            info.setmCountry(bdLocation.getAddress().country);
            //if (bdLocation.getAddress().countryCode != null)
            info.setmCountryCode(bdLocation.getAddress().countryCode);
            //if (bdLocation.getAddress().province != null)
            info.setmProvince(bdLocation.getAddress().province);
            //if (bdLocation.getAddress().city != null)
            info.setmCity(bdLocation.getAddress().city);
            //if (bdLocation.getAddress().cityCode != null)
            info.setmCityCode(bdLocation.getAddress().cityCode);
            // if (bdLocation.getAddress().district != null)
            info.setmDistrict(bdLocation.getAddress().district);
        }
        return info;
    }

}
*/
